# @Version        : 1.0
# @Update Time    : 2024/9/13 23:12
# @File           : post_model.py
# @IDE            : PyCharm
# @Desc           : 文件描述信息
from advanced_alchemy.base import BigIntAuditBase
from sqlalchemy import String, Integer, Index
from sqlalchemy.orm import Mapped, mapped_column
from src.core.base.orm.orm import AbstractORMModel


# class SysPost(AbstractORMModel):
#     __tablename__ = "sys_post"
#     __table_args__ = {"comment": "岗位表"}
#
#     post_code: Mapped[str] = mapped_column(String(20), comment="岗位编码")
#     post_name: Mapped[str] = mapped_column(String(20), comment="岗位名称")
#     remark: Mapped[str | None] = mapped_column(String(500), comment="备注")
#     post_sort: Mapped[int] = mapped_column(Integer, nullable=False, comment="显示顺序")
#     status: Mapped[str] = mapped_column(
#         String(1), nullable=False, default="0", comment="状态（1正常 2停用）"
#     )


class SysPost(BigIntAuditBase):
    __tablename__ = "sys_post"
    __table_args__ = (
        Index("ix_sys_post_post_code", "post_code"),
        Index("ix_sys_post_status", "status"),
        {"comment": "岗位表"},
    )
    post_code: Mapped[str] = mapped_column(String(20), comment="岗位编码")
    post_name: Mapped[str] = mapped_column(String(20), comment="岗位名称")
    remark: Mapped[str | None] = mapped_column(String(500), comment="备注")
    post_sort: Mapped[int] = mapped_column(Integer, nullable=False, comment="显示顺序")
    status: Mapped[str] = mapped_column(
        String(1), nullable=False, default="0", comment="状态（1正常 2停用）"
    )